package org.jiaxin.nutrient.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Properties;

/**
 * @author jiaxin
 * @version 1.0
 * @description: TODO
 * @date 2024/5/6 21:41
 */

public class SpringBootConfig {
    private Properties properties;



    public SpringBootConfig() throws IOException {
        Resource resource = new ClassPathResource("application.properties");
        this.properties= PropertiesLoaderUtils.loadProperties(resource);
    }

    public String getDbUsername(){
        return this.properties.getProperty("spring.datasource.username");
    }

    public String getDbPassword(){
        return this.properties.getProperty("spring.datasource.password");
    }
    public String getDbUrl(){
        return this.properties.getProperty("spring.datasource.url");
    }
   public String getDbDriver(){
        return this.properties.getProperty("spring.datasource.driver-class-name");
   }



}
